<template>
	<view>
		<view class='groupMember-list'>
			<view class='groupMember-item' v-for="(item,index) in memberList" :key='index' :data-item='item' @tap="selectMember">
				<image class='groupMember-left' :src='item.avatar'></image>
				<view class='groupMember-right'>{{item.nickName}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	import app from '../../App.vue';
	let disp = require("../../utils/broadcast");
	import {
		GYZJMODEL as gyzjModel
	} from '@/utils/gyzjModel.js'; 
	export default {
		
			data() {
				return {
					id:"",
					memberList:[],
					groupId:""
				}
			},
			onLoad(options) {
				let me = this;
				this.id = options.id;
				this.groupId = options.groupId;
				this.getGroupMember();
			},
			methods: {
				selectMember(e){
					const target = e.currentTarget.dataset.item;
					getApp().globalData.selectMember = target;
					uni.navigateBack()
				},
				getGroupMember(){
					var me = this;
					// 获取群成员
					var pageNum = 1,
						pageSize = 1000,groupMemberOld=[],groupMemberNew=[],gyzjMemberOld_string='';
					var options = {
						pageNum: pageNum,
						pageSize: pageSize,
						groupId: this.groupId,
						success: function(resp){
							if(resp && resp.data && resp.data.data){
								/*设置新的头像*/  
								var groupMemberOld=resp.data.data;
								
								me.groupMember = groupMemberOld;
								var data={
									'all_info':JSON.stringify(groupMemberOld)
								}    
								gyzjModel.prototype.getSettingAllavatar(me.id,data).then(result => {
									me.memberList=[...result.data.owner,...result.data.member];
								}) 
								
							}
						},
						error: function(err){
				
						}
					};
					this.$im.conn.listGroupMember(options);
				},
				}
	}
</script>

<style>
.groupMember-item{
	display: flex;
	align-items: center;
	border:1px solid #efefef;
	background: white;
	padding:30upx
}
.groupMember-left{
	width:80upx;
	height:80upx;
	border-radius: 4px;
	
	margin-right:30upx;
	
}
.groupMember-right{
	color:#333;
	font-size: 32upx;
		
}
</style>
